import React, { lazy } from 'react';

// 一级
let Index = lazy(() => import('../view/Index/Index'))
let Login = lazy(() => import('../view/Login'))
let Register = lazy(() => import('../view/Register/Register'))
let Detail = lazy(() => import('../view/Detail'))
let Search = lazy(() => import('../view/Search'))
let Success = lazy(() => import('../view/Order/Success'))
let SearchList = lazy(() => import('../view/SearchList'))
let City = lazy(() => import('../view/City'))
let NotFound = lazy(() => import('../view/NotFound'))
let Code = lazy(() => import('../view/Register/Code'))
let Password = lazy(() => import('../view/Register/Password'))
let Address = lazy(() => import('../view/address/Address'))
let Modify = lazy(() => import('../view/address/Modify'))
let Order = lazy(() => import('../view/Order/Order'))
let Orders = lazy(() => import('../view/Order/Orders'))
let Set = lazy(() => import('../view/Set'))

// 二级
let Home = lazy(() => import('../view/Index/Home'))
let Cate = lazy(() => import('../view/Index/Cate'))
let Shopcart = lazy(() => import('../view/Index/Shopcart'))
let Mine = lazy(() => import('../view/Index/Mine'))

// 配置路由表
export default [
    {
        path: '/index',
        component: Index,
        children: [
            {
                path: '/index/home',
                component: Home,
            },
            {
                path: '/index/cate',
                component: Cate,
            },
            {
                path: '/index/shopcart',
                component: Shopcart,
            },
            {
                path: '/index/mine',
                component: Mine,
            },
            {
                from: '/index',
                to: '/index/home'
            },
            {
                path: '*',
                component: NotFound,
            }
        ]
    },
    {
        path: '/login',
        component: Login,
    },
    {
        path: '/register',
        component: Register,
    },
    {
        path: '/detail',
        component: Detail,
    },
    {
        path: '/search',
        component: Search,
    },
    {
        path: '/success',
        component: Success,
    },
    {
        path: '/searchlist',
        component: SearchList,
    },
    {
        path: '/city',
        component: City,
    },
    {
        path: '/code',
        component: Code,
    },
    {
        path: '/password',
        component: Password,
    },
    {
        path: '/address',
        component: Address,
    },
    {
        path: '/modify',
        component: Modify,
    },
    {
        path: '/set',
        component: Set,
    },
    {
        path: '/order',
        component: Order,
    },
    {
        path: '/orders',
        component: Orders,
    },
    {
        from: '/',
        to: '/index'
    },
    {
        path: '*',
        component: NotFound,
    },
]